package cn.wp.ewallet.upms.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.wp.common.core.model.WpPage;
import cn.wp.common.core.util.BeanUtil;
import cn.wp.ewallet.upms.dao.PaUserInfoDao;
import cn.wp.ewallet.upms.model.dto.UserInfoDto;
import cn.wp.ewallet.upms.model.entity.PaUserInfoDoo;
import cn.wp.ewallet.upms.service.PaUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by yangjin on 2020/2/6
 */
@Service
public class PaUserInfoServiceImpl implements PaUserInfoService {

    @Autowired
    private PaUserInfoDao paUserInfoDao;
    @Override
    public WpPage<UserInfoDto> getPaUserInfoList(String userTel, WpPage wpPage) {
        WpPage<PaUserInfoDoo> paUserInfoDooWpPage = paUserInfoDao.selectPaUserInfoList(userTel, wpPage);
        WpPage<UserInfoDto> userInfoDtoWpPage = paUserInfoDooWpPage.doConvertDto(UserInfoDto.class, new BeanUtil.Processor<PaUserInfoDoo, UserInfoDto>() {
            @Override
            public void convert(PaUserInfoDoo source, UserInfoDto target) {
                target.setCreateDate(DateUtil.formatDateTime(source.getCreateDate()));
            }
        });
        return userInfoDtoWpPage;
    }
}
